<?php

	// +----------------------------------------------------------------------
	// | APP版本
	// +----------------------------------------------------------------------
	// | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
	// +----------------------------------------------------------------------
	// | Author: 微尘 <yicmf@qq.com>
	// +----------------------------------------------------------------------

	namespace app\model\app;

	use app\model\file\Attachment;

	class Version extends Common
	{

		/**
		 * 模型名称
		 * @var string
		 */
		protected $name = 'app_version';



        /**
         * 新增修改
         * @param $data
         */
        public static function onBeforeInsert($data)
        {
            $data['wgt_url'] = isset($data['wgt_url_id']) ? (self::$request->domain().Attachment::where('id',$data['wgt_url_id']) ->value('url')):'';
            $data['pkg_url'] = isset($data['pkg_url_id']) ? (self::$request->domain(). Attachment::where('id',$data['pkg_url_id']) ->value('url')):'';
        }
//        public function getWgtUrlAttr($value, $data)
//        {
//            return $value?$value
//        }
//		public function file()
//		{
//			return $this->belongsTo(Attachment::class,'file_id');
//		}
//
//		public function iosFile()
//		{
//			return $this->belongsTo(Attachment::class,'ios_file_id');
//		}

	}
